package com.bdqn.t350.entity;

import java.util.List;

public class Page {

    //总页数
    private int totalPageCount = 0;

    //页面大小，每页需要显示的记录数
    private int pageSize = 2;

    //总记录数，表中的记录数
    private int totalCount = 0;

    //当前页数--页面传递过来的参数
    private int currPageNo = 1;

    //每页需要显示的对象集合
    private List<Pet> petList;

    public int getTotalPageCount() {
        return totalPageCount;
    }

    public void setTotalPageCount(int totalPageCount) {
        this.totalPageCount = totalPageCount;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        if (totalCount > 0) {
            this.totalCount = totalCount;
            //计算总页数
            //totalPageCount = this.totalCount % pageSize == 0 ? (this.totalCount / pageSize) : (this.totalCount / pageSize + 1);
            if (this.totalCount % pageSize == 0) {
                totalPageCount = this.totalCount / pageSize;
            } else {
                totalPageCount = (this.totalCount / pageSize) + 1;
            }
        }
    }

    public int getCurrPageNo() {
        return currPageNo;
    }

    public void setCurrPageNo(int currPageNo) {
        this.currPageNo = currPageNo;
    }

    public List<Pet> getPetList() {
        return petList;
    }

    public void setPetList(List<Pet> petList) {
        this.petList = petList;
    }

    public Page() {
    }

    public Page(int totalPageCount, int pageSize, int totalCount, int currPageNo, List<Pet> petList) {
        this.totalPageCount = totalPageCount;
        this.pageSize = pageSize;
        this.totalCount = totalCount;
        this.currPageNo = currPageNo;
        this.petList = petList;
    }
}
